#!/usr/bin/env python 
# -*- coding: utf-8 -*-
# @Time    : 2022/9/19 8:25
# @Author  : Junzhao
# @File    : 约瑟夫生者死者小游戏.py
# @Software: PyCharm

ship = {}
for x in range(1, 31):
    ship[x] = 1

print(ship)

x = 1
# 计数器
counter = 0
y = 0
while x <= 30:
    if x == 31:
        x = 0
    elif y == 15:
        break
    else:
        if ship[x] == 0:
            x += 1
            continue
        elif ship[x] == 1:
            # i += 1
            counter += 1
            if counter == 9:
                ship[x] = 0
                print(f"{x}号下船")
                counter = 0
                x += 1
                y += 1
            else:
                x += 1
                counter += 1

print(ship)
